package Day07;

import java.util.Scanner;

public class CalAirPrice3 {
    public static void main(String[] args) {
        Scanner scn= new Scanner(System.in);
        System.out.println("请输入原价");
        double price=scn.nextDouble();
        System.out.println("请输入当前月份");
        int month=scn.nextInt();
        System.out.println("请选择您订购的套餐");
        System.out.println("1.头等舱，2.商务舱，3.经济舱");
        int setMeal= scn.nextInt();
        double total=calculatePrice(price,month,setMeal);
        if (total!=-1){
            System.out.println("最终价格为"+total);
        }
    }
    public static double calculatePrice(double price,int month,int setMeal){
        double total=0.0;
        //检测数据合法
        if (price<0){
            System.out.println("价格不合法");
            return -1;
        }
        if (month>12||month<1){
            System.out.println("没有该月份");
            return -1;
        }
        if (setMeal>3||setMeal<1){
            System.out.println("没有该套餐");
            return -1;
        }
        if(month>=5&&month<=10){//旺季
            switch (setMeal){
                case 1:price*=0.9;break;
                case 2:price*=0.85;break;
                case 3:price*=0.8;break;
            }
        }else{//淡季
            switch (setMeal){
                case 1:price*=0.7;break;
                case 2:price*=0.65;break;
                case 3:price*=0.6;break;
            }
        }
        return price;


    }


}
